<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    :footer="null"
    cancelText="关闭">

    <table id="table_report" class="table table-striped table-bordered table-hover">

           			<tr>
           				<td style="width:90px;text-align: right;padding-top: 80px;">基本信息:</td>
           				<td>
           					<p style="float: left;">


             车场编号：<span id="parkCode" >
           {{result.parkCode }}
                    </span><br>


             停车场名称：<span id="parkName" >
           {{result.parkName }}
                    </span><br>


             月租车处理方式（1、月租车过期禁止入场，2、月租车过期按临时车收费 3、过期n天后禁止入场）：<span id="handleMonthlyRentalCar" >
           {{result.handleMonthlyRentalCar }}
                    </span><br>


             月租车过期几天后禁止入场：<span id="overDay" >
           {{result.overDay }}
                    </span><br>


             临时车入场开闸方式(1、自动开闸，2、确认开闸， 3、不开闸)：<span id="temporaryGateIn" >
           {{result.temporaryGateIn }}
                    </span><br>


             临时车出场开闸方式(1、自动开闸，2、确认开闸， 3、不开闸)：<span id="temporaryGateOut" >
           {{result.temporaryGateOut }}
                    </span><br>


             月租车入场开闸方式(1、自动开闸，2、确认开闸)：<span id="monthlyRentalGateIn" >
           {{result.monthlyRentalGateIn }}
                    </span><br>


             月租车出场开闸方式(1、自动开闸，2、确认开闸)：<span id="monthlyRentalGateOut" >
           {{result.monthlyRentalGateOut }}
                    </span><br>


             临时车位数量：<span id="temporaryParking" >
           {{result.temporaryParking }}
                    </span><br>


             临时车出场收费0元自动开闸(0，关闭，1、开启)：<span id="temporaryCarZero" >
           {{result.temporaryCarZero }}
                    </span><br>


             临时车位满位（1:禁止临时车驶入,2:临时车驶入需确认驶入，3:禁止所以车辆驶入）：<span id="temporaryStallType" >
           {{result.temporaryStallType }}
                    </span><br>


             军警车自动放行(0，关闭，1、开启)：<span id="policeCar" >
           {{result.policeCar }}
                    </span><br>


             0牌车自动放行(0，关闭，1、开启)：<span id="zeroCar" >
           {{result.zeroCar }}
                    </span><br>


             无牌车入场自动开闸(0，关闭，1、开启)：<span id="unlicensedCar" >
           {{result.unlicensedCar }}
                    </span><br>


             临时车禁止驶入小车场(0、关闭，1、开启)：<span id="temporaryStopIn" >
           {{result.temporaryStopIn }}
                    </span><br>


             创建人：<span id="createUser" >
           {{result.createUser }}
                    </span><br>


             更新日期：<span id="updateTime" >
           {{result.updateTime }}
                    </span><br>

  创建时间：<span id="createTime" >
           {{result.createTime }}
                    </span><br>
	</p>
			</td>
                			</tr>

                				<tr>
                                    <td style="width:90px;text-align: right;padding-top: 60px;">详情:</td>
                                    <td>
                                        <p style="float: left;">


                                        </p>
                                    </td>
                            	</tr>

                			<tr>
                				<td style="text-align: center;" colspan="10">
                                 <a-button type="primary" @click="close">关闭</a-button>
                				</td>
                			</tr>
                		</table>

  </a-modal>
</template>

<script>
  import { httpAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import moment from "moment"

  export default {
    name: "ConfigParkInfoModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
         result: {

                },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules:{
        },
        url: {
          add: "/parking/configParkInfo/add",
          edit: "/parking/configParkInfo/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        this.edit({});
      },
      edit (record) {
             Object.assign(this.result, record);
              this.visible = true;
            },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        const that = this;
        // 触发表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            let formData = Object.assign(this.model, values);
            //时间格式化
            formData.updateTime = formData.updateTime?formData.updateTime.format('YYYY-MM-DD HH:mm:ss'):null;

            httpAction(httpurl,formData,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })



          }
        })
      },
      handleCancel () {
        this.close()
      },


    }
  }
</script>

<style lang="less" scoped>

</style>